<?php
/**
 * @copyright meila.com
 * @author zhanglei11@
 * @name 
 * @param 
 *         $xxx = 作用
 * @static 
 *         加关注队列
 * 
 * 
 */
$dir = dirname(dirname(__FILE__));
include($dir.'/__queue_global.php');

class ml_mq_add_follow extends MqClass{
    const QUEUE_NAME = ML_QUEUENAME_ADD_FOLLOW;
    private $_oFollow;
    private $_oFans;
    private $_oRedis;
    public function __construct($queue)
    {
        $this->_oFollow = new ml_model_dbFollow();
        $this->_oFans = new ml_model_dbFans();
        
        parent::__construct($queue);
    }

    public function run_job() {        
        //接收的数据
        $arr = $this->src_data;
        
        $rs = $this->_oFans->addFans($arr['follow_uid'], $arr['uid']);
        
        //增加redis    关注数
        $this->_oRedis = new ml_model_rdsCount();
        $this->_oRedis->incrFollowCnt($arr['uid']);            //    增加 当前用户的关注数        
        $this->_oRedis->incrFansCnt($arr['follow_uid']);    //    增加关注人的粉丝数

        ml_tool_sendMq::add_atnick_follow($arr['uid'], $arr['follow_uid']);
        return true;
    }

    
 

}





ml_run_queue_check(ml_mq_add_follow::QUEUE_NAME);

$conf_array = ml_factory::load_standard_conf('redis');
$conf_array = $conf_array['meila_queue'];
$xblog_obj = new ml_mq_add_follow(new RsQueue(ml_mq_add_follow::QUEUE_NAME));
$argv[1]   = __FILE__;
$xblog_obj->setArgv($argv[1]);
$xblog_obj->execute();
?>